package com.wf.course.web.controller.course;

import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.utils.page.PageBean;
import com.wf.course.model.course.ChapterPlayRecord;
import com.wf.course.service.IChapterPlayRecordService;
import com.wf.course.web.Interceptor.LogInfo;
/**
 * 
 * @content 课程列表Controller
 */
@RequestMapping("chapterPlayRecord")
@Controller
public class ChapterPlayRecordController {

	@Autowired
	private IChapterPlayRecordService playRecordService;

	/**
	 * 播放记录列表展示
	 * @param pageNo
	 * @param pageSize
	 * @param courseName
	 * @param chapterName
	 * @param speakerName
	 * @param model
	 * @return
	 */
	@LogInfo("查询播放记录信息列表")
	@RequestMapping("playRecordList")
	public String chapterList(@RequestParam(value = "pageNo", required = false) Integer pageNo,
			@RequestParam(value = "pageSize", required = false) Integer pageSize,
			@RequestParam(value = "courseName", required = false) String courseName, 
			@RequestParam(value = "chapterName", required = false) String chapterName, 
			@RequestParam(value = "speakerName", required = false) String speakerName, 
			@RequestParam(value = "userName", required = false) String userName, 
			@RequestParam(value="studyBeginTime",required=false) String studyBeginTime,
			@RequestParam(value="studyEndTime",required=false) String studyEndTime,
			Model model) {

		// 组装一个查询条件的map
		Map<String, Object> cons = new HashMap<String, Object>();
		cons.put("courseName", courseName);
		cons.put("chapterName", chapterName);
		cons.put("speakerName", speakerName);
		cons.put("userName", userName);
		cons.put("studyBeginTime", studyBeginTime);
		cons.put("studyEndTime", studyEndTime);
		
		PageBean<ChapterPlayRecord> pageBean = new PageBean<ChapterPlayRecord>(pageNo, pageSize, null, cons);
		pageBean.setUrl("chapterPlayRecord/playRecordList");
		this.playRecordService.indexInfo(pageBean);
		
		model.addAttribute("page", pageBean);
		return "course/chapterPlayRecordList";
	}

	 

}
